import { http } from "@/utils/http/axios";

export function getPageList(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: "/system/app/page",
			method: "GET",
			params
		},
		{
			isTransformResponse: false
		}
	);
}
export function getUserRolePage(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `system/app/page`,
			method: "get",
			params
		},
		{
			isTransformResponse: false
		}
	);
}

export function getApp(id: number) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `/system/app/${id}`,
			method: "GET"
		},
		{
			isTransformResponse: true
		}
	);
}
export function getAppList() {
	return http.request<any>(
		{
			url: `/system/app/list`,
			method: "GET"
		},
		{
			isTransformResponse: true
		}
	);
}

export function save(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `/system/app`,
			method: "POST",
			params: params
		},
		{
			isTransformResponse: false
		}
	);
}
/**
 * 删除角色
 * @param ids 角色ID
 * @returns
 */
export function remove(ids: number | Array<number>) {
	return http.request<API.Response.BasicResponse>({
		url: `/system/app/${ids}`,
		method: "DELETE"
	});
}

export function changeStatus(params = {}) {
	return http.request<API.Response.BasicResponse>({
		url: "system/app/changeStatus",
		method: "put",
		data: params
	});
}

export function optionSelecet() {
	return http.request<API.Response.BasicResponse>({
		url: "system/app/optionselect",
		method: "GET"
	});
}

/**
 * 更新数据
 * @returns
 */
export function update(params = {}) {
	return http.request<API.Response.BasicResponse>({
		url: `/system/app`,
		method: "PUT",
		params: params
	});
}
